﻿using System;
using System.Collections.Generic;
using Transfer.Utils;

namespace QuickModel.ColumnTransModel
{
	public class ComparerColumnConfigInfo : IComparer<ColumnConfigInfo>
	{
		public int Compare(ColumnConfigInfo x, ColumnConfigInfo y)
		{
			bool flag = x == y;
			int result;
			if (flag)
			{
				result = 0;
			}
			else
			{
				bool flag2 = x.ThisColumnCategory > y.ThisColumnCategory;
				if (flag2)
				{
					result = -1;
				}
				else
				{
					bool flag3 = x.ThisColumnCategory < y.ThisColumnCategory;
					if (flag3)
					{
						result = 1;
					}
					else
					{
						bool flag4 = x.ThisColumnCategory == EColumnCategory.eRectangle;
						if (flag4)
						{
							bool flag5 = Geometry.GreaterThan(x.Length * x.Width, y.Length * y.Width);
							if (flag5)
							{
								result = -1;
							}
							else
							{
								result = 1;
							}
						}
						else
						{
							bool flag6 = x.ThisColumnCategory == EColumnCategory.eCircle;
							if (flag6)
							{
								bool flag7 = Geometry.GreaterThan(x.Diameter, y.Diameter);
								if (flag7)
								{
									result = -1;
								}
								else
								{
									result = 1;
								}
							}
							else
							{
								bool flag8 = Geometry.GreaterThan(x.RefPos.X, y.RefPos.X);
								if (flag8)
								{
									result = -1;
								}
								else
								{
									bool flag9 = Geometry.LessThan(x.RefPos.X, y.RefPos.X);
									if (flag9)
									{
										result = 1;
									}
									else
									{
										bool flag10 = Geometry.GreaterThan(x.RefPos.Y, y.RefPos.Y);
										if (flag10)
										{
											result = -1;
										}
										else
										{
											bool flag11 = Geometry.LessThan(x.RefPos.Y, y.RefPos.Y);
											if (flag11)
											{
												result = 1;
											}
											else
											{
												result = 0;
											}
										}
									}
								}
							}
						}
					}
				}
			}
			return result;
		}
	}
}
